/*
 Navicat Premium Data Transfer

 Source Server         : localhost
 Source Server Type    : MySQL
 Source Server Version : 100428 (10.4.28-MariaDB)
 Source Host           : localhost:3306
 Source Schema         : ledger_db

 Target Server Type    : MySQL
 Target Server Version : 100428 (10.4.28-MariaDB)
 File Encoding         : 65001

 Date: 03/07/2025 22:36:11
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for ledger_fields
-- ----------------------------
DROP TABLE IF EXISTS `ledger_fields`;
CREATE TABLE `ledger_fields` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '字段ID',
  `ledger_id` bigint(20) NOT NULL COMMENT '所属台账ID',
  `name` varchar(100) NOT NULL COMMENT '字段名称',
  `type` varchar(50) NOT NULL COMMENT '字段类型（text, number, date, select）',
  `validation_rules` text DEFAULT NULL COMMENT '校验规则（JSON）',
  `options` text DEFAULT NULL COMMENT '字段选项（下拉框使用，JSON格式）',
  `field_order` int(11) DEFAULT 0 COMMENT '字段排序',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=47 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of ledger_fields
-- ----------------------------
BEGIN;
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (1, 1, '联系电话', 'text', '{}', NULL, 1);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (2, 1, '备注', 'text', '{}', NULL, 2);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (3, 1, '部门', 'text', '{}', NULL, 3);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (4, 1, '数量', 'number', '{}', NULL, 4);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (5, 1, '操作人', 'text', '{}', NULL, 5);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (6, 2, '状态', 'select', '{}', '[\"正常\", \"异常\"]', 1);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (7, 2, '备注', 'text', '{}', NULL, 2);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (8, 2, '日期', 'date', '{}', NULL, 3);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (9, 2, '部门', 'text', '{}', NULL, 4);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (10, 2, '联系电话', 'text', '{}', NULL, 5);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (11, 3, '联系电话', 'text', '{}', NULL, 1);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (12, 3, '日期', 'date', '{}', NULL, 2);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (13, 3, '数量', 'number', '{}', NULL, 3);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (14, 3, '部门', 'text', '{}', NULL, 4);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (15, 4, '状态', 'select', '{}', '[\"正常\", \"异常\"]', 1);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (16, 4, '日期', 'date', '{}', NULL, 2);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (17, 4, '姓名', 'text', '{}', NULL, 3);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (18, 4, '联系电话', 'text', '{}', NULL, 4);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (19, 5, '状态', 'select', '{}', '[\"正常\", \"异常\"]', 1);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (20, 5, '备注', 'text', '{}', NULL, 2);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (21, 5, '金额', 'number', '{}', NULL, 3);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (22, 5, '数量', 'number', '{}', NULL, 4);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (23, 5, '部门', 'text', '{}', NULL, 5);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (24, 6, '姓名', 'text', '{}', NULL, 1);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (25, 6, '金额', 'number', '{}', NULL, 2);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (26, 6, '数量', 'number', '{}', NULL, 3);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (27, 6, '部门', 'text', '{}', NULL, 4);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (28, 7, '状态', 'select', '{}', '[\"正常\", \"异常\"]', 1);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (29, 7, '日期', 'date', '{}', NULL, 2);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (30, 7, '备注', 'text', '{}', NULL, 3);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (31, 7, '联系电话', 'text', '{}', NULL, 4);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (32, 7, '操作人', 'text', '{}', NULL, 5);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (33, 8, '联系电话', 'text', '{}', NULL, 1);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (34, 8, '备注', 'text', '{}', NULL, 2);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (35, 8, '日期', 'date', '{}', NULL, 3);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (36, 8, '数量', 'number', '{}', NULL, 4);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (37, 8, '操作人', 'text', '{}', NULL, 5);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (38, 9, '日期', 'date', '{}', NULL, 1);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (39, 9, '联系电话', 'text', '{}', NULL, 2);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (40, 9, '状态', 'select', '{}', '[\"正常\", \"异常\"]', 3);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (41, 9, '操作人', 'text', '{}', NULL, 4);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (42, 10, '联系电话', 'text', '{}', NULL, 1);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (43, 10, '状态', 'select', '{}', '[\"正常\", \"异常\"]', 2);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (44, 10, '备注', 'text', '{}', NULL, 3);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (45, 10, '日期', 'date', '{}', NULL, 4);
INSERT INTO `ledger_fields` (`id`, `ledger_id`, `name`, `type`, `validation_rules`, `options`, `field_order`) VALUES (46, 10, '部门', 'text', '{}', NULL, 5);
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
